/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-08-04
 * Time: 18:05
 */
public class ThreadDemo1 {
    public static boolean flag = true;
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            while(flag) {
                System.out.println("hello thread");
            }
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });

        t.start();
        flag = false;
    }
}
